package com.demo.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.demo.mapper.base.TableColumnInfoMapper;
import com.demo.model.base.TableColumnInfo;
import com.demo.model.base.TableColumnInfoExample;
import com.demo.service.base.TableColumnInfoService;

@Service
public class TableColumnInfoServiceImpl implements TableColumnInfoService {
	@Autowired
	TableColumnInfoMapper mapper;

	@Override
	@Transactional
	public int add(TableColumnInfo record) {
		if (null == record) {
			return 0;
		}
		return mapper.insert(record);
	}

	@Override
	@Transactional
	public int addBatch(List<TableColumnInfo> records) {
		if (null == records || records.size() == 0) {
			return 0;
		}
		return mapper.insertBatch(records);
	}

	@Override
	@Transactional
	public int deleteByCondition(TableColumnInfoExample example) {
		return mapper.deleteByExample(example);
	}

	@Override
	public TableColumnInfo getById(Integer id) {
		return mapper.selectByPrimaryKey(id);
	}

	@Override
	public List<TableColumnInfo> findByCondition(TableColumnInfoExample example) {
		return mapper.selectByExample(example);
	}

	@Override
	public int getCount(TableColumnInfoExample example) {
		return mapper.countByExample(example);
	}

}
